package models

import "gorm.io/gorm"

type Book struct {
	gorm.Model
	BookTitle      string `gorm:"type:varchar(100)"`
	BookTitleImage string `gorm:"type:text"`
	BookAuthorId   int    `gorm:"type:int(11)"`
}

type ReadLog struct {
	UserId int    `gorm:"type:int(11)"`
	BookId int    `gorm:"type:int(11)"`
	Type   string `gorm:"type:enum('在读','读完')"`
}

func (b *Book) CreateBook() error {
	return DB.Create(&b).Error
}
